<?php
require 'phorm/forms/Form.php';
require 'phorm/forms/IFormDelegate.php';
class IndexViewController implements IFormDelegate
{
	public function __construct()
	{
		if(isset($_POST['label']))
			Form::formWithKeyAndDelegate(null, $this);
	}
	
	
	public function willProcessForm(&$form)
	{
	
	}
	
	public function didProcessForm(&$form) 
	{
		if($form->isValid)
		{
			$r = new Recipe();
			$r->label             = $form->label;
			$r->description       = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris tincidunt. Quisque malesuada. Nam urna augue, gravida at, laoreet vel, ultricies a, nunc. Vivamus eget nibh. Phasellus dictum facilisis ipsum. Vivamus id leo. Aliquam a orci. Suspendisse metus. Donec ultrices justo.';
			$r->bitmap            = $form->bitmap;
			$r->bitmap_thumbnail  = $form->bitmap;
			$r->save();
		}
	}
}
?>